﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DalEntity.Implementacao
{
   public  class DalCheckPointEntrega
    {
        ShippingEntities db ;
       public DalCheckPointEntrega()
       {
            db = Base.GetInstance();
      }    

       public bool Gravar(Modelo.CheckPointEntrega  checkPoint)
       {

           CheckPointEntrega chkEnt = GenericTypeConverter.ConvertType<Modelo.CheckPointEntrega, CheckPointEntrega>(checkPoint);
           chkEnt.Entrega = db.Entrega.SingleOrDefault(c => c.Id == checkPoint.IdEntrega);
           db.CheckPointEntrega.AddObject(chkEnt);
           return( db.SaveChanges()>0);
 
       }

    }
}
